package com.xydtech.ecard.ecard.service.impl;

import com.xydtech.common.model.ResponseModel;
import com.xydtech.ecard.config.domain.EcardDeptPackageOrg;
import com.xydtech.ecard.config.mapper.EcardDeptPackageOrgMapper;
import com.xydtech.ecard.ecard.domain.EcardApiAccessRecordList;
import com.xydtech.ecard.ecard.domain.EcardApiVisitRecord;
import com.xydtech.ecard.ecard.mapper.EcardAccessRecordListMapper;
import com.xydtech.ecard.ecard.service.EcardApiPunchInService;
import com.xydtech.ecard.ecard.service.IEcardAccessRecordListService;
import com.xydtech.ecard.statistics.domain.EcardUserChecking;
import com.xydtech.ecard.statistics.mapper.EcardUserCheckingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 打卡接口ServiceImpl
 *
 * @author yjs
 * @date 2022/7/29 14:43
 */

@Service
public class EcardApiPunchInServiceImpl implements EcardApiPunchInService {
    @Autowired
    EcardUserCheckingMapper ecardUserCheckingMapper;
    @Autowired
    EcardDeptPackageOrgMapper ecardDeptPackageOrgMapper;

    /**
     * 查询本周包保（固定）打卡统计
     *
     * @author yjs
     * @date 2022/7/29 16:51
     */

    @Override
    public List<Map<String, Object>> getFixedWeekPunchInCount(Long userId) throws Exception {

        return ecardUserCheckingMapper.getFixedWeekPunchInCount(userId);
    }

    /**
     * 查询本周营销打卡记录
     *
     * @author yjs
     * @date 2022/8/1 10:12
     */

    @Override
    public List<EcardUserChecking> getNotFixedWeekPunchInList(Long userId) throws Exception {
        return ecardUserCheckingMapper.getNotFixedWeekPunchInList(userId);
    }

    /**
     * 查询不同打卡类型打卡记录
     *
     * @author yjs
     * @date 2022/7/29 14:06
     */
    @Override
    public List<EcardUserChecking> getPunchInRecordList(EcardUserChecking userChecking) throws Exception {
        return ecardUserCheckingMapper.selectEcardUserCheckingList(userChecking);
    }

    /**
     * 查询机构下包保（固定）打卡点
     *
     * @author yjs
     * @date 2022/7/29 16:58
     */

    @Override
    public List<EcardDeptPackageOrg> getFixedPunchPoint(EcardDeptPackageOrg ecardDeptPackageOrg) throws Exception {
        return ecardDeptPackageOrgMapper.selectEcardDeptPackageOrgList(ecardDeptPackageOrg);
    }

    @Override
    public int addPunchPoint(EcardUserChecking userChecking) throws Exception {
        return ecardUserCheckingMapper.insertEcardUserChecking(userChecking);
    }
}
